#include <iostream>
#include <cstring>
using namespace std;

struct node
{
    int data;
    string str;
    node *lchild= nullptr;
    node *rchild= nullptr;
    node *next= nullptr;
};

void del(node *&head,node *&T)
{
    node *p = head->next;
    node *q = head;
    while (p != T) {
        q = p;
        p = p->next;
    }
    q->next = p->next;
    p->next= nullptr;
}

void build(node *head,node *l,node *r)
{
    node *p=head->next;
    while(nullptr!=p->next)
    {
        p=p->next;
    }
    p->next=new node;
    p=p->next;
    p->lchild=l;
    p->rchild=r;
    p->data=l->data+r->data;
    p->next=nullptr;
}


void rscan(node *T);
void lscan(node *T)
{
    node *p=T;
    if(p->lchild== nullptr&&p->rchild== nullptr)
    {
        p->str="0"+p->str;
    }
    else {
        node *q = p->rchild;
        lscan(q);
        q = p->lchild;
        lscan(q);
    }
}
void rscan(node *T)
{
    node *p=T;
    if(p->lchild== nullptr&&p->rchild== nullptr)
    {
        p->str="1"+p->str;
    }
    else {

        node *q = p->rchild;
        rscan(q);
        q = p->lchild;
        rscan(q);

    }
}


void find(node *&head)
{
    node *pmin=head;
    node *qmin;
    node *p=head->next;
    node *q;
    int i=0,j=0;
    while(nullptr!=p)
    {
        if(pmin->data>p->data)
        {
            i++;
            pmin=p;
        }
        q=p;
        p=p->next;
    }
    qmin=head;
    p=head->next;
    while(nullptr!=p)
    {
        if(qmin->data>p->data&&p!=pmin)
        {
            j++;
            qmin=p;
        }
        q=p;
        p=p->next;
    }
    if(j>=i)
    {
        node *temp=qmin;
        qmin=pmin;
        pmin=temp;
    }
    build(head,qmin,pmin);
    del(head,qmin);
    del(head,pmin);
    lscan(qmin);
    rscan(pmin);
}


int main()
{
    node *head=new node;
    head->data=10000000;
    node *p=head;
    node *ptr[100];
    int n;
    cin>>n;

    for(int i=0;i<n;i++)
    {
        node *T=new node;
        p->next=T;
        cin>>T->data;
        ptr[i]=T;
        p=T;
    }
    p->next= nullptr;
    p=head->next;
    while(p->next!= nullptr)
    {
        find(head);
        p=head->next;
    }
    for(int i=0;i<n;i++)
    {
        cout<<ptr[i]->str<<endl;
    }

}